package beans;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;

import javax.swing.ImageIcon;




public class Card
{
	int state;//状态 0是亮图 1是暗图
	int type;//第几张卡片，一共有四张植物卡
	String name;//植物名字

	public Card(int type,String name)
	{
		this.name=name;
		this.type=type;
		state=0;
	}
	
	public void paint(Graphics g)//画卡片图
	{
		 Image image = (new ImageIcon("植物大战僵尸/卡片/卡片图/"+name+state+".png")).getImage();
		 g.drawImage(image, 95+54*type, 8, null);//绘制图片API
	}
	public boolean isClick(int mbx,int mby)//是否点击了卡片图
	{
		if(new Rectangle(95+54*type, 8, 50, 70).contains( mbx, mby))
		{
			return true;
		}
		return false;
	}
}
